<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>添加固件版本</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">

	<script type="text/javascript" src="{$url_js}jquery-2.2.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}bootstrap.min.js"></script>

	
	<style type="text/css">
		{literal}
			span {
				color: red;
			}
			input[type='text'] {
				width: 300px;
			}
		    .container {
			    width: 96%;
		    }
		{/literal}
	</style>
</head>
<body>

<div class="container" >
	<form action="?do=Updata" method="post" enctype="multipart/form-data">
		<table class="table table-bordered table-striped" align="center">
			<tbody>
			<tr>
				<td colspan="3"><h5>添加固件版本</h5>
				</td>
			</tr>
			<tr>
				<td>版本号：<br>
					(<span>格式：v1.0.0</span>)
				</td>
				<td><input type="text" class="form-control" id="version" name="version" placeholder="版本号" /></td>
			</tr>

			<tr>
				<td>固件文件名称：<br>
				</td>
				<td><input type="text" class="form-control" id="name" name="name" placeholder="固件名称" /></td>
			</tr>

			<tr>
				<td>
					上传固件：
				</td>
				<td>
					<input type="file" id="firmware" name="firmware" />
				</td>
			</tr>

			<tr>
				<td>MD5值：
				</td>
				<td><input type="text" class="form-control" id="MD5" name="MD5" placeholder="MD5值" /></td>
			</tr>

			<tr>
				<td>&nbsp;</td>
				<td align="center">
					<input type="submit" id="add_btn" class="btn btn-primary" value="保存"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="button" onclick="history.back()" class="btn btn-primary" value="取消"/>
				</td>
			</tr>
			</tbody>
		</table>
	</form>
</div>
<div>&nbsp;</div>

{literal}
	<script type="text/javascript">
        $("#add_btn").click(function () {
            var version = $.trim($("#version").val()),
                name = $.trim($("#name").val()),
                firmware = $.trim($("#firmware").val()),
                md5 = $.trim($("#MD5").val());

            if(!version.length){
                top.swal('出错了', '请选填写版本号！', 'error');
                return false;
            }

            if(!/v\d+(\.\d+){0,2}$/.test(version)){
                top.swal('出错了', '请填写正确的版本号格式！', 'error');
                return false;
            }

            if(!name.length){
                top.swal('出错了', '固件文件名不能为空！', 'error');
                return false;
            }

            if(!firmware.length){
                top.swal('出错了', '请上传固件！', 'error');
                return false;
            }

            if(!md5.length){
	            top.swal('出错了','请填写固件MD5值！','error');
	            return false;
            }

            return true;
        });

	</script>
{/literal}

</body>
<html>